package com.runrunfast.fxj.enums;

/**
 * @author: 陈胤训
 * @create: 2019-03-13 14:14
 **/
public enum UserStatusEnum {

    NORMAL(1, "正常"),
    REVIEW(0,"审核"),
    DISABLE(-1, "禁用"),
    PHONE_EXIST(12, "手机号码已存在"),
    USER_FAILED(11, "用户操作失败"),
    PARAMETER_FAILED(11, "参数不正确"),
    PASSWORD_FAILED(14, "密码错误"),
    USER_NULL(13, "用户不存在"),
    OBJECT_NULL(10, "用户对象为空");

    private Integer code;
    private String desc;

    UserStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static UserStatusEnum get(Integer code) {
        if (null == code) {
            return NORMAL;
        }
        UserStatusEnum[] enums = UserStatusEnum.values();
        for (UserStatusEnum anEnum : enums) {
            if (anEnum.getCode().equals(code)) {
                return anEnum;
            }
        }
        return NORMAL;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
